<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/goods_list.css">
<script src="__TEMP__/{$style}/public/js/public_assembly.js" type="text/javascript"></script>
<style type="text/css">
.order_div>span {width:33%;}
.order_div>span:nth-child(3) .ico_order_state{right:20%;}
.cart-box{overflow: hidden;height: 30px;display: block;width: 50%;float: right;position: relative;}
.add-cart{width: 30px;height: 30px;background: url(__TEMP__/{$style}/public/images/btn_plus_normal.png) no-repeat;background-size: contain;position: absolute;right: 2px;top: 0px;z-index: 2;cursor: pointer;}
.s-buy{font-family: Helvetica, "STHeiti STXihei", "Microsoft YaHei", Tohoma,Arial;}
</style>
<div class="order_div">
	<span class="select" value='1'>综合</span>
	<span value='2'>销量</span>
	<span value='3'>价格<i class='ico_order_state'></i></span>
</div>
<section class="members_goodspic" id="main_list">
	<ul></ul>
</section>

<script>
$(function(){
	GetgoodsList(1);
	$('.order_div span').click(function(){
		$('.order_div span').removeClass('select');
		$(this).addClass('select');
		GetgoodsList($(this).attr('value'));
	})
	$('.order_div span:nth-child(3)').click(function(){
		if(!$(this).children().is('.statu_two')){
			$(this).children().addClass('statu_two');
		}else{
			$(this).children().removeClass('statu_two');
		}
	})
})
function GetgoodsList(sear_type){
	var orderState='asc';
	if($('.order_div span:nth-child(3)').children().is('.statu_two')){
		orderState='desc';
	}
	$.ajax({
		type:"post",
		url : "APP_MAIN/[url]",
		data : {
			'{$wherename}':'{$sear_name}',
			'sear_type':sear_type,
			'order_state':orderState,
			'controlType':'{$controlType}',
			"shop_id" : "{$shop_id}"
		},
		beforeSend:function(){
			showLoadMaskLayer();
		},
		success : function(data){
			if(data != null){
				var html = '';
				html +='<ul>';
				for(i=0; i<data.length;i++){
					html+='<li class="gooditem"><div class="img"> <a href="APP_MAIN/goods/goodsdetail?id='+data[i]['goods_id']+'">';
					html+='<img class="lazy" src="__ROOT__/'+data[i]['pic_cover_small']+'" >';
					html+='</a></div><div class="info">';
					html+='<p class="goods-title"><a href="APP_MAIN/goods/goodsdetail?id='+data[i]['goods_id']+'" >'+data[i]['goods_name']+'</a></p>';
					html+='<p class="goods-price"><em>￥'+data[i]['promotion_price']+'</em></p>';
					html+='<p style="font-size:12px;width:50%;float:left;"><em style="color: #999;">销量:'+data[i]['sales']+'</em><a href="APP_MAIN/goods/goodsdetail?id='+data[i]['goods_id']+'"></a></p>';
					html+='<div class="cart-box" id="number_575"><a class="add-cart increase" data-goods_id="575" href="javascript:CartGoodsInfo('+data[i]['goods_id']+','+data[i]['state']+')"></a><a class="decrease hide" data-goods_id="575" style="right: 60px;"></a></div>';
					html+='</div></li>';
				}
				html +='</ul>';
				html += '<div class="h50"></div>';
				$("#main_list").html(html);
				hiddenLoadMaskLayer();
			}
		}
	})
}
</script>